[GOBBLIN-1778] Add house keeping thread in DagManager to periodically sync in memory state with mysql table#3635
Merged
ZihanLi58 merged 5 commits intoapache:masterfrom Feb 6, 2023
Merged
Conversation
added 3 commits
February 2, 2023 10:03
… sync in memory state with mysql table
Codecov Report
@@ Coverage Diff @@
## master #3635 +/- ##
============================================
+ Coverage 40.16% 46.58% +6.42%
- Complexity 3544 10672 +7128
============================================
Files 791 2133 +1342
Lines 33285 83558 +50273
Branches 3699 9290 +5591
============================================
+ Hits 13368 38924 +25556
- Misses 18601 41069 +22468
- Partials 1316 3565 +2249
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Will-Lo
requested changes
Feb 3, 2023
Comment on lines
+278
to
+280
| if (!this.isActive) { | ||
| return; | ||
| } |
Contributor
There was a problem hiding this comment.
Would this ever cause dags to be missed? If during the process where one new dag is being added and then the leader is changed
Contributor
Author
There was a problem hiding this comment.
Oh good catch, I add the check in the load dag method to avoid this scenario.
| } | ||
| } | ||
|
|
||
| private void loadingDagsFromDagStateStore() throws IOException { |
Contributor
There was a problem hiding this comment.
Tiny grammar nit: rename to loadDagFromDagStateStore? Since when it reads it's more declarative
| addDag(dag, false, false); | ||
| loadingDagsFromDagStateStore(); | ||
| this.houseKeepingThreadPool = Executors.newSingleThreadScheduledExecutor(); | ||
| for (int delay = houseKeepingThreadInitialDelay; delay < 180; delay *= 2) { |
Contributor
There was a problem hiding this comment.
make 180 a static variable named: MAX_HOUSEKEEPING_THREAD_DELAY ?
Will-Lo
approved these changes
Feb 3, 2023
umustafi
pushed a commit
to umustafi/gobblin
that referenced
this pull request
Feb 8, 2023
… sync in memory state with mysql table (apache#3635) * address comments * use connectionmanager when httpclient is not cloesable * [GOBBLIN-1778] Add house keeping thread in DagManager to periodically sync in memory state with mysql table * fix unit test * address comments --------- Co-authored-by: Zihan Li <zihli@zihli-mn2.linkedin.biz>
phet
added a commit
to phet/gobblin
that referenced
this pull request
Feb 13, 2023
* upstream/master: [GOBBLIN-1774] Util for detecting non optional uniontypes Hive tables (apache#3632) [GOBBLIN-1773] Fix bugs in quota manager (apache#3636) [GOBBLIN-1782] Fix Merge State for Flow Pending Resume statuses (apache#3639) [GOBBLIN-1755] Support extended ACLs and sticky bit for file based distcp (apache#3616) [GOBBLIN-1780] Refactor/rename YarnServiceIT to YarnServiceTest (apache#3637) [GOBBLIN-1778] Add house keeping thread in DagManager to periodically sync in memory state with mysql table (apache#3635) Register gauge metrics for change monitors (apache#3634)
phet
added a commit
to phet/gobblin
that referenced
this pull request
Mar 24, 2023
* upstream/master: [GOBBLIN-1774] Util for detecting non optional uniontypes Hive tables (apache#3632) [GOBBLIN-1773] Fix bugs in quota manager (apache#3636) [GOBBLIN-1782] Fix Merge State for Flow Pending Resume statuses (apache#3639) [GOBBLIN-1755] Support extended ACLs and sticky bit for file based distcp (apache#3616) [GOBBLIN-1780] Refactor/rename YarnServiceIT to YarnServiceTest (apache#3637) [GOBBLIN-1778] Add house keeping thread in DagManager to periodically sync in memory state with mysql table (apache#3635) Register gauge metrics for change monitors (apache#3634)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dear Gobblin maintainers,
Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below!
JIRA
Description
Now dag managers have the assumption that it is the only process that can update mysql table and the in-memory state is always in sync with mysql. But we do notice that during the leader transforms period, it's possible that two dag manager can run concurrently and update the mysql db at the same time.
To address that, we need either add a lock to make sure only one dag manager is working at one time, or we need to have a housekeeping thread to periodically sync the in-memory state with the mysql table. After discussion, we choose to go with the later approach and we do have the assumption that GaaS submit jobs without specifying job.id, so jobs with same flow execution id will not share the staging dir and can be executed concurrently.
Besides that, during adding test, I figure out there will be NPE if we try to set the dag manager as inactive, add a small fix for that as well.
Tests
Just add a single thread for housekeeping so will not affect other functions. Also add unit test to make sure we close the thread when de-active DagManager to avoid memory leak
Commits